<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="Generator" content="ECSHOP v2.7.3"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>会员注册_{{config('sys.siteName')}}</title>
    <meta name="Keywords" content=""/>
    <meta name="Description" content=""/>
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <link type="text/css" rel="stylesheet" href="/home/default/css/cart.css"/>
    <link href="{{$temps_src}}/css/css.css" type="text/css" rel="stylesheet">
    <link type="text/css" rel="stylesheet" href="/home/default/css/BombboxLogin.css"/>
    <link type="text/css" rel="stylesheet" href="/home/default/css/logincommon.css"/>
    <link rel="stylesheet" href="/home/default/css/register.css"/>
    <link rel="stylesheet" href="/admin/css/xadmin.css">
    <script src="/admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/admin/js/jquery.min.js"></script>
</head>
<body style="background:#fff;">
@include('home.default.header')
  
<div class="block">
    <div class="">
        <div id="content">
            <div class="login-newbg" style="background-image: url(/home/default/images/login_bg.jpg);"></div>
            <div class="content-layout">
                <div class="login-wrap">
                    <div class="logo-content">
                        <div class="login-others">
                            <h2 style="margin:30px auto;">会员注册 </h2>
                            <div class="percent"><a href="javascript:;"
                                                    class="other-logo logo-qq statis site-change phonelogin"><i></i><span>个人会员</span></a>
                            </div>
                            <div class="percent"><a href="javascript:;"
                                                    class="other-logo logo-wechat statis site-change wxlogin"><i></i><span>企业会员</span></a>
                            </div>
                            <div class="person" style="display: none;">
                                <form class="layui-form">
                                <input type="hidden" name="type" value="1">
                                    <div class="layui-form-item">
                                    <label class="layui-form-label" >用户名</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="name" required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                 </div>
                                 <div class="layui-form-item">
                                    <label class="layui-form-label">密码</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="password" id='password' required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:105px;">确认密码</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="repassword" id='repassword' required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label person">姓名</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="nickname" 
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label person" style="width:105px;">身份证号码</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="idCard"  
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:105px;">电话号码</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="phone" required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">邮箱</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="email" required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">地址</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="address" required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item" style="margin-top: 40px;">
                                    <button id="embed-submit" class="layui-btn" style="width: 90px;" lay-filter="submit" lay-submit="">
                                        注    册
                                    </button>
                                </div>
                            </form>
                            </div>
                            <div class="company" style="display: none;">
                            <form class="layui-form">
                            <input type="hidden" name="type" value="2">
                                    <div class="layui-form-item">
                                    <label class="layui-form-label" >用户名</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="name" required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                 </div>
                                 <div class="layui-form-item">
                                    <label class="layui-form-label">密码</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="password" id='password' required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:105px;">确认密码</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="repassword" id='repassword' required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label person" style="width:110px;">单位名称</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="nickname" 
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label person" style="width:110px;">机构代码</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="idCard"  
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width:105px;">电话号码</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="phone" required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">邮箱</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="email" required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">地址</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="address" required lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item" style="margin-top: 40px;">
                                    <button id="embed-submit" class="layui-btn" style="width: 90px;" lay-filter="submit" lay-submit="">
                                        注    册
                                    </button>
                                </div>
                            </form>
                           </div>
                        </div>
                        <div id="login-footer-1" class="login-footer login-footer-1"><!--勾选协议-->
                            <p class="denglu" style="font-size: 16px;">
                                已有帐号?
                                <a style="font-size: 16px; color: #0e771e; text-decoration: none;" site="3" href="/login" id="parbox-toSocialAccountLogin"
                                   class="qt-c00BE6E statis site-change">
                                    立即登录
                                </a></p></div>
                        <div class="clearfix"></div>
                    </div>
                </div>


            </div>

        </div>
    </div>
</div>
</div>
</div>
</div>
@include('home.default.footer')
</body>
<script>
    $(document).on('click', '.wxlogin', function () {

        // 请求登录二维码
        $.ajax({
            type: "GET",
            url: "/getWxPic",
            dataType: 'json',
            data: "",
            success: function(data){
                if(data.status_code == 200){
                    $('.wxpic img').attr('src', data.url);
                    $('.percent').hide();
                    $('.wxpic').show();
                    // 轮询登录状态
                    timer = setInterval(() => {
                        // 请求参数是二维码中的场景值
                        $.ajax({
                            type: "GET",
                            url: "/loginCheck",
                            dataType: 'json',
                            data: {
                                wechat_flag:data.weChatFlag,
                            },
                            success: function(res) {
                                if (res.status_code == 200) {
                                    $('.wxpic img').attr('src', "/home/default/images/login_success.jpg");
                                    setInterval(function(){
                                        window.location.href = '/';
                                    },2500)
                                }

                            }
                        })
                    }, 2000)
                }


            },
        })
    })
    $(document).on('click', '.phonelogin', function () {
        $('.percent').hide();
        $('.person').show();
    })
    $(document).on('click', '.wxlogin', function () {
        $('.percent').hide();
        $('.company').show();
    })

</script>
<script>layui.use(['form', 'layer'],
        function() {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;


            //监听提交
            form.on('submit(submit)',

                function(data) {
                    var password = $('#password').val()
                    var repassword = $('#repassword').val()
                    if(password != repassword){
                        layer.alert('两次输入密码不同，请重新输入', {
                                        icon: 5,
                                        time:2500,
                                        end:function () {
                                            location.reload()
                                        }
                                    })
                    }else{
                       //发异步，把数据提交给php
                    $.ajax({
                        type:'POST',
                        url:'/doregister',
                        dataType:'json',
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        },
                        data:data.field,
                        success:function (data) {
                            if(data.status_code == 200){
                                layer.alert(data.res, {
                                        icon: 1,
                                        time:1500,
                                        end:function () {
                                            $('.wxpic img').attr('src', "/home/default/images/login_success.jpg");
                                            setInterval(function(){
                                                window.location.href = '/login';
                                            },1500)

                                        }
                                    },
                                );
                            }
                            else{
                                layer.alert(data.res, {
                                        icon: 5,
                                    },
                                    function() {
                                        //关闭当前frame
                                        xadmin.close();

                                        // 可以对父窗口进行刷新
                                        xadmin.father_reload();
                                    });
                            }

                        },
                        error:function () {

                        }

                    }) 
                    }
                    

                    return false;
                });

        });</script>